package com.example.spring_demo.service.impl;

import com.example.spring_demo.mapper.LogMapper;
import com.example.spring_demo.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author cxx
 * @create 2020-08-20 22:11
 **/
@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogMapper logMapper;

    @Override
    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
    public void insert(String log) {
        logMapper.insert(log);
        int i = 1/0;
    }
}
